<?php

/**
 * @author xuanky
 * @copyright 2012
 */
        //so dong hien thi tren mot trang
        $hienthi = 8;
        //tinh tong so trang
        if(isset($_GET['page']) && (int)$_GET['page']){
            $page = $_GET['page'];
        }else{
            $sodong = "select id from thongbao";
            $kq=executeQuery($sodong);
            $kq_sodong =mysql_num_rows($kq);
            $so = $kq_sodong;
            if($so>$hienthi){
                $page = ceil($so/$hienthi);
            }else{
                $page = 1;
            }
        }
        //vitri bat dau hien thi
        $vitri = (isset($_GET['vitri'])&& (int)$_GET['vitri']) ? $_GET['vitri']:0; 

    $sql = "SELECT id,TieuDe, date_format(NgayDang,'%d/%m/%Y') as NgayDang FROM  `thongbao` ORDER BY  `thongbao`.`NgayDang` DESC limit $vitri,$hienthi  ";
    $dsthongbao = executeQuery($sql);
          

?>    